<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>About_M2SCI_tools</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Documentation</center>
    <div align="right">Last update : 05/10/2004</div>
    <p>
      <b>About_M2SCI_tools</b> - Generally speaking about tools to convert Matlab files to Scilab...</p>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>Scilab 3.0 includes a new version of useful tools to convert Matlab M-files to Scilab.</p>
    <p>
  Taking a Matlab M-file, <tt>
        <b>mfile2sci</b>
      </tt> modifies this files so that it can be
  compiled by Scilab. After that this compiled code is converted to a "tree" of instructions
  by <tt>
        <b>macr2tree</b>
      </tt>. This "tree" is an imbrication of Scilab lists and tlists and
  is the basis for conversion. Each instruction of this "tree" is converted to Scilab and
  inference is done to known what are the variables. Once this "tree" is converted to Scilab,
  code is generated using <tt>
        <b>tree2code</b>
      </tt>.
  </p>
    <p>
   All tlists used for coding this tree (and we call "MSCI tlists") are listed below:
  </p>
    <dl>
      <dd>
        <b></b>
        <dd>
          <li>
            <b>
              <font color="maroon">funcall</font>
            </b>: tlist representing a function call created by <tt>
              <b>Funcall</b>
            </tt>
          </li>
          <li>
            <b>
              <font color="maroon">operation</font>
            </b>: tlist representing an operation created by <tt>
              <b>Operation</b>
            </tt>
          </li>
          <li>
            <b>
              <font color="maroon">variable</font>
            </b>: tlist representing a variable created by <tt>
              <b>Variable</b>
            </tt>
          </li>
          <li>
            <b>
              <font color="maroon">cste</font>
            </b>: tlist representing a constant created by <tt>
              <b>Cste</b>
            </tt>
          </li>
          <li>
            <b>
              <font color="maroon">equal</font>
            </b>: tlist representing an instruction created by <tt>
              <b>Equal</b>
            </tt>
          </li>
          <li>
            <b>
              <font color="maroon">ifthenelse</font>
            </b>: tlist representing an IF/THEN/ELSE control instruction created inside M2SCI kernel functions</li>
          <li>
            <b>
              <font color="maroon">while</font>
            </b>: tlist representing a WHILE control instruction created inside M2SCI kernel functions</li>
          <li>
            <b>
              <font color="maroon">selectcase</font>
            </b>: tlist representing a SELECT/CASE control instruction created inside M2SCI kernel functions</li>
          <li>
            <b>
              <font color="maroon">for</font>
            </b>: tlist representing a FOR control instruction created inside M2SCI kernel functions</li>
        </dd>
      </dd>
    </dl>
    <p>
  The contents of these tlists is described in corresponding help pages.
  </p>
    <p>
  Operations are converted using a fonction named <tt>
        <b>%&lt;opcode&gt;2sci</b>
      </tt> with opcode
  the Scilab code for this operator. See help page for overloading to have these codes. All
  these functions are already written and are in directory SCI/macros/m2sci/percent/.
  </p>
    <p>
  Function calls are converted using a function called <tt>
        <b>sci_&lt;Matlab_function_name&gt;</b>
      </tt>.
  Some of these functions have been written and are in directory SCI/macros/m2sci/sci_files/.
  We are working on increasing the set of Matlab functions converted. However, everybody can
  written such functions using help page sci_files.
  </p>
    <p>
  Inference is done using tlists of type "infer" containing fields:
  </p>
    <dl>
      <dd>
        <b></b>
        <dd>
          <li>
            <b>
              <font color="maroon">dims</font>
            </b>: list of dimensions</li>
          <li>
            <b>
              <font color="maroon">type</font>
            </b>: "type" tlist</li>
          <li>
            <b>
              <font color="maroon">contents</font>
            </b>: "contents" tlist if a Cell or a Struct</li>
        </dd>
      </dd>
    </dl>
    <p>
  Type is a tlist of type "type" containing fields:
  </p>
    <dl>
      <dd>
        <b></b>
        <dd>
          <li>
            <b>
              <font color="maroon">vtype</font>
            </b>: data type</li>
          <li>
            <b>
              <font color="maroon">property</font>
            </b>: property</li>
        </dd>
      </dd>
    </dl>
    <p>To have more details about inference see help page for m2scideclare.</p>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="../translation/mfile2sci.htm">
        <tt>
          <b>mfile2sci</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../translation/translatepaths.htm">
        <tt>
          <b>translatepaths</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../programming/overloading.htm">
        <tt>
          <b>overloading</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="sci_files.htm">
        <tt>
          <b>sci_files</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Funcall.htm">
        <tt>
          <b>Funcall</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Operation.htm">
        <tt>
          <b>Operation</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Variable.htm">
        <tt>
          <b>Variable</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Cste.htm">
        <tt>
          <b>Cste</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Infer.htm">
        <tt>
          <b>Infer</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Type.htm">
        <tt>
          <b>Type</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="Equal.htm">
        <tt>
          <b>Equal</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="m2scideclare.htm">
        <tt>
          <b>m2scideclare</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Authors</font>
    </h3>
    <dl>
      <dd>
        <b></b>V.C.</dd>
    </dl>
  </body>
</html>
